using System.Data;
using System.Threading;

namespace Net
{
    public class ClientProcedureService
    {
		public int PRo_BackUp(string Path, string Name)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{Path, Name};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2000", b);
			netCallback.DataReach.WaitOne(3000);
			return (int)netCallback.AsyncObject;
		}

		public void PRo_BackUp(string Path, string Name, IntCallback intCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.intCallback = intCallback;
			netCallback.State = NetCallback.WaitInt;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {Path, Name};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2000", b);
		}

		public int Pro_Restore(string Path, string FileName)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{Path, FileName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2002", b);
			netCallback.DataReach.WaitOne(3000);
			return (int)netCallback.AsyncObject;
		}

		public void Pro_Restore(string Path, string FileName, IntCallback intCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.intCallback = intCallback;
			netCallback.State = NetCallback.WaitInt;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {Path, FileName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2002", b);
		}

		public DataTable Pro_GetAllSubject()
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2004", b);
			netCallback.DataReach.WaitOne(3000);
			return (DataTable)netCallback.AsyncObject;
		}

		public void Pro_GetAllSubject(DataTableCallback dataTableCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.dataTableCallback = dataTableCallback;
			netCallback.State = NetCallback.WaitDataTable;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2004", b);
		}

		public DataTable Pro_GetQuestionTypeBySubjectName(string subject_name)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{subject_name};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2006", b);
			netCallback.DataReach.WaitOne(3000);
			return (DataTable)netCallback.AsyncObject;
		}

		public void Pro_GetQuestionTypeBySubjectName(string subject_name, DataTableCallback dataTableCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.dataTableCallback = dataTableCallback;
			netCallback.State = NetCallback.WaitDataTable;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {subject_name};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2006", b);
		}

		public DataTable Pro_GetAllExamModel()
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2008", b);
			netCallback.DataReach.WaitOne(3000);
			return (DataTable)netCallback.AsyncObject;
		}

		public void Pro_GetAllExamModel(DataTableCallback dataTableCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.dataTableCallback = dataTableCallback;
			netCallback.State = NetCallback.WaitDataTable;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2008", b);
		}

		public DataTable Pro_GetExamModelByModelName(string ModelName)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{ModelName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2010", b);
			netCallback.DataReach.WaitOne(3000);
			return (DataTable)netCallback.AsyncObject;
		}

		public void Pro_GetExamModelByModelName(string ModelName, DataTableCallback dataTableCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.dataTableCallback = dataTableCallback;
			netCallback.State = NetCallback.WaitDataTable;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {ModelName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2010", b);
		}

		public int Pro_AddSubject(string SubjectName, string UserName)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{SubjectName, UserName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2012", b);
			netCallback.DataReach.WaitOne(3000);
			return (int)netCallback.AsyncObject;
		}

		public void Pro_AddSubject(string SubjectName, string UserName, IntCallback intCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.intCallback = intCallback;
			netCallback.State = NetCallback.WaitInt;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {SubjectName, UserName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2012", b);
		}

		public int Pro_DelSubject(string SubjectName)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{SubjectName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2014", b);
			netCallback.DataReach.WaitOne(3000);
			return (int)netCallback.AsyncObject;
		}

		public void Pro_DelSubject(string SubjectName, IntCallback intCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.intCallback = intCallback;
			netCallback.State = NetCallback.WaitInt;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {SubjectName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2014", b);
		}

		public int Pro_UpdateSubject(string SubjectName, string NewName)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{SubjectName, NewName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2016", b);
			netCallback.DataReach.WaitOne(3000);
			return (int)netCallback.AsyncObject;
		}

		public void Pro_UpdateSubject(string SubjectName, string NewName, IntCallback intCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.intCallback = intCallback;
			netCallback.State = NetCallback.WaitInt;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {SubjectName, NewName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2016", b);
		}

		public int Pro_UpdateUser(string UserName, string RealName, int UserLevel, string UserPassword, string NewUserName)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{UserName, RealName, UserLevel, UserPassword, NewUserName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2018", b);
			netCallback.DataReach.WaitOne(3000);
			return (int)netCallback.AsyncObject;
		}

		public void Pro_UpdateUser(string UserName, string RealName, int UserLevel, string UserPassword, string NewUserName, IntCallback intCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.intCallback = intCallback;
			netCallback.State = NetCallback.WaitInt;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {UserName, RealName, UserLevel, UserPassword, NewUserName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2018", b);
		}

		public DataTable Pro_GetQuestionTypeTotalNumByQuestionType(string QuestionType, string SubjectName)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{QuestionType, SubjectName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2020", b);
			netCallback.DataReach.WaitOne(3000);
			return (DataTable)netCallback.AsyncObject;
		}

		public void Pro_GetQuestionTypeTotalNumByQuestionType(string QuestionType, string SubjectName, DataTableCallback dataTableCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.dataTableCallback = dataTableCallback;
			netCallback.State = NetCallback.WaitDataTable;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {QuestionType, SubjectName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2020", b);
		}

		public DataTable Pro_GetUserByName(string UserName)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{UserName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2022", b);
			netCallback.DataReach.WaitOne(3000);
			return (DataTable)netCallback.AsyncObject;
		}

		public void Pro_GetUserByName(string UserName, DataTableCallback dataTableCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.dataTableCallback = dataTableCallback;
			netCallback.State = NetCallback.WaitDataTable;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {UserName};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2022", b);
		}

		public int Pro_AddUser(string username, string userpassword, int UserLevel, string userrealname)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{username, userpassword, UserLevel, userrealname};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2024", b);
			netCallback.DataReach.WaitOne(3000);
			return (int)netCallback.AsyncObject;
		}

		public void Pro_AddUser(string username, string userpassword, int UserLevel, string userrealname, IntCallback intCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.intCallback = intCallback;
			netCallback.State = NetCallback.WaitInt;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {username, userpassword, UserLevel, userrealname};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2024", b);
		}

		public int Pro_DelUser(string username)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{username};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2026", b);
			netCallback.DataReach.WaitOne(3000);
			return (int)netCallback.AsyncObject;
		}

		public void Pro_DelUser(string username, IntCallback intCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.intCallback = intCallback;
			netCallback.State = NetCallback.WaitInt;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {username};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2026", b);
		}

		public DataTable Pro_GetQuestionsRequire(int id)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{id};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2028", b);
			netCallback.DataReach.WaitOne(3000);
			return (DataTable)netCallback.AsyncObject;
		}

		public void Pro_GetQuestionsRequire(int id, DataTableCallback dataTableCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.dataTableCallback = dataTableCallback;
			netCallback.State = NetCallback.WaitDataTable;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {id};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2028", b);
		}

		public DataTable Pro_GetUser()
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2030", b);
			netCallback.DataReach.WaitOne(3000);
			return (DataTable)netCallback.AsyncObject;
		}

		public void Pro_GetUser(DataTableCallback dataTableCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.dataTableCallback = dataTableCallback;
			netCallback.State = NetCallback.WaitDataTable;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2030", b);
		}

		public int Pro_ChangePassword(string UserName, string OldPassword, string NewPassword)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{UserName, OldPassword, NewPassword};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2032", b);
			netCallback.DataReach.WaitOne(3000);
			return (int)netCallback.AsyncObject;
		}

		public void Pro_ChangePassword(string UserName, string OldPassword, string NewPassword, IntCallback intCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.intCallback = intCallback;
			netCallback.State = NetCallback.WaitInt;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {UserName, OldPassword, NewPassword};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2032", b);
		}

		public DataTable Pro_GetUserLogin(string UserName, string UserPassword)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.DataReach = new ManualResetEvent(false);
			netCallback.State = NetCallback.Block;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[]{UserName, UserPassword};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2034", b);
			netCallback.DataReach.WaitOne(3000);
			return (DataTable)netCallback.AsyncObject;
		}

		public void Pro_GetUserLogin(string UserName, string UserPassword, DataTableCallback dataTableCallback)
		{
			NetCallback netCallback = new NetCallback();
			netCallback.dataTableCallback = dataTableCallback;
			netCallback.State = NetCallback.WaitDataTable;
			NetService.callbackMap[NetService.net.PackageIdentifier] = netCallback;
			object[] parameters = new object[] {UserName, UserPassword};
			byte[] b = ByteArrayParser.ObjectToByteArray(parameters);
			NetService.net.ProcessSend("2034", b);
		}


    }
}
